package com.atguigu.srb.core.controller.admin;


import com.atguigu.common.result.Result;
import com.atguigu.srb.core.pojo.entity.Lend;
import com.atguigu.srb.core.service.LendService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 标的准备表 前端控制器
 * </p>
 *
 * @author ZLHao
 * @since 2021-07-12
 */
@Api(tags = "标的管理")
@RestController
@RequestMapping("/admin/core/lend")
@Slf4j
public class AdminLendController {

    @Resource
    private LendService lendService;


    @ApiOperation("标的列表")
    @GetMapping("/list")
    public Result list(){
        List<Lend> lends =  lendService.selectAll();
        return  Result.ok().data("list",lends);

    }

    @ApiOperation("获取标的信息")
    @GetMapping("/show/{id}")
    public Result show(@PathVariable Long id){
        Map<String,Object> result = lendService.selectById(id);
        return Result.ok().data("lendDetail",result);
    }


}

